package leetcode.bfs;

import leetcode.bfs.common.BFSUtils;
import leetcode.tree.common.Node;
import leetcode.tree.common.TreeUtils;

class Solution117 {
    public Node connect(Node root) {
        return BFSUtils.connectPro(root);
    }
}

public class leetcode117 {
    public static void main(String[] args) {
        Solution117 solution117 = new Solution117();
        Integer[] nums = {1, 2, 3, 4, 5, null, 7};
        Integer[] nums1 = {1, 2, 3, 4, 5, null, 6, 7, null, null, null, null, 8};
        Integer[] nums2 = {3, 9, 20, null, null, 15, 7};
        Node root = TreeUtils.generateLeetcodeTreeForNode(nums);
        Node root1 = TreeUtils.generateLeetcodeTreeForNode(nums1);
        Node root2 = TreeUtils.generateLeetcodeTreeForNode(nums2);
        System.out.println(TreeUtils.leetcodeSpecialStandardOutputForBinaryTreeForNode(solution117.connect(root)));
        System.out.println(TreeUtils.leetcodeSpecialStandardOutputForBinaryTreeForNode(solution117.connect(root1)));
        System.out.println(TreeUtils.leetcodeSpecialStandardOutputForBinaryTreeForNode(solution117.connect(root2)));
    }
}
